<!--
 * @Author: Neko
 * @Date: 2021-05-21 14:00:22
 * @LastEditTime: 2021-05-26 10:59:36
 * @LastEditors: Neko
-->
<template>
  <view
    
    class="detail__container"
  >
    <u-navbar
			:title="$t('locales.applyAgent')"
			:title-width="570"
			:background="{ background: '#fff' }"
			title-color="#333"
			:is-back="true"
		/>

    <view class="detail__content">
      <BusinessForm :type="1" :store-id="storeId" :store-data="storeData" @confirm="onConfirmBusinessForm" />
    </view>
  </view>
</template>

<script>
import BusinessForm from '@/components/businessForm'
import { getStoreById } from '@/api/http/user'

export default {
  components: {
    BusinessForm
  },

  data() {
    return {
      routerParams: {},

      storeData: {}
    }
  },

  computed: {
    storeId() {
      return this.routerParams.storeId
    }
  },

  onLoad(routerParams) {
    this.routerParams = routerParams

    this.getStoreById()
  },

  methods: {
    async getStoreById() {
      try {
        const res = await getStoreById({
          storeId: this.storeId
        })

        if (res.code === 200) {
          this.storeData = res.data
        } else {
          return uni.showToast({
            title: res.message,
            icon: 'none'
          })
        }
      } catch (e) {
        throw Error(e)
      }
    },

    onConfirmBusinessForm() {
      uni.navigateBack()
    }
  }
}
</script>

<style lang="scss" scoped>
.detail__container {
  padding: 63rpx 24rpx;
  background-color: #fff;

  .detail__title {
    margin-bottom: 60rpx;
    font-size: 28rpx;
    color: #666;

    .shop {
      color: #333;
    }
  }
}
</style>